<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/7/19 0019
 * Time: 上午 9:52
 */
namespace app\index\Controller;
use app\index\model\Topic as TopicModel;
use think\Controller;
use think\Db;

class Topic extends Controller{
    public function skip_topic(){
        $topic = TopicModel::paginate(3);
       // $topic= Db::table('lsy_topic')->query("select * from lsy_topic ");
        $po = Db::table('lsy_topic')->query("select * from lsy_topic WHERE pid=0");
        //var_dump($topic); exit();//可以查看是否成功获取数据

       $this->assign('topic', $topic);
        $this->assign('pc', $po);

        return $this->fetch('user/topic');

    }
    public function topic_ajax(){
        if(request()->isAjax()){
            $name=input('pname');//获取表单数据
            $pt = Db::table('lsy_topic')->query("select * from lsy_topic WHERE pid=$name");
            // $this->assign('st', $pt);
            header('Content-Type:text/html; charset=utf-8');
            exit(json_encode($pt));
        }

    }
    public function topic_ajaxx()
    {
        if (request()->isAjax()) {
            $name = input('poname');
            $sont = Db::table('lsy_topic')->query("select * from lsy_topic WHERE pid=$name");
            //$this->assign('sont',$sont);
            header('Content-type:text/html;charset=utf-8');
            exit(json_encode($sont));
//            return $name;,
        }
    }
}